"use strict";
Page({
    onShareAppMessage: function () {
        return {
            title: 'scroll-view',
            path: 'page/component/pages/scroll-view/scroll-view'
        };
    },
    data: {
        classification: [],
        activeKey: 0,
        toView: 'new',
    },
    onLoad: function () {
        console.log(111111);
        var _this = this;
        wx.request({
            url: 'http://shequ.220514.xyz/index.php/api/consume/shop_articleindex',
            method: "POST",
            success: function (res) {
                console.log(res);
                _this.setData({
                    classification: res.data.data
                });
            },
            fail: function (err) {
                console.log(err);
            },
        });
    },
    scroll: function (e) {
        console.log(this.data.classification);
        if (e.detail.scrollTop >= 0 && e.detail.scrollTop <= 230) {
            this.setData({
                activeKey: 0
            });
        }
        if (e.detail.scrollTop >= 230 && e.detail.scrollTop <= 490) {
            this.setData({
                activeKey: 1
            });
        }
        if (e.detail.scrollTop >= 490 && e.detail.scrollTop <= 750) {
            this.setData({
                activeKey: 2
            });
        }
        if (e.detail.scrollTop >= 750 && e.detail.scrollTop <= 1020) {
            this.setData({
                activeKey: 3
            });
        }
        if (e.detail.scrollTop >= 1020 && e.detail.scrollTop <= 1280) {
            this.setData({
                activeKey: 4
            });
        }
        if (e.detail.scrollTop >= 1280) {
            this.setData({
                activeKey: 5
            });
        }
    },
    setHeight: function (e) {
        if (e.currentTarget.id == 1) {
            this.setData({
                scrollTop: 0
            });
        }
        if (e.currentTarget.id == 2) {
            this.setData({
                scrollTop: 250
            });
        }
        if (e.currentTarget.id == 3) {
            this.setData({
                scrollTop: 510
            });
        }
        if (e.currentTarget.id == 4) {
            this.setData({
                scrollTop: 770
            });
        }
        if (e.currentTarget.id == 5) {
            this.setData({
                scrollTop: 1040
            });
        }
        if (e.currentTarget.id == 6) {
            this.setData({
                scrollTop: 1300
            });
        }
    },
});
